package com.xjl.springbootnetty.netty.socketdemo;

import java.io.IOException;
import java.net.Socket;

/**
 * @ClassName Client
 * @Author user
 * @Date 2021/11/09:15:40
 * @Description
 * @Version 1.0.0
 */
public class Client {
    public static void main(String[] args) {
        try {
            Socket socket = new Socket("localhost",8086);

            while (true){
                Thread.sleep(5000);
                doStart(socket);
            }


        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }
    }

    private static void doStart(Socket socket) {
        try {
            socket.getOutputStream().write("我是客户端".getBytes());

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
